<%-- 
    Document   : showGatherers
    Created on : Jan 22, 2014, 9:05:46 PM
    Author     : roman
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>


<f:message var="nadpis" key="top.showGatherers"/>

<s:layout-render name="/mainLayout.jsp" nadpis="${nadpis}">
    <s:layout-component name="body">
        <s:useActionBean beanclass="cz.muni.fi.pa165.mushroom.website.web.GathererActionBean" var="actionBean"/>
        <s:messages/>
        <s:errors/>
        <h2><f:message key="top.showGatherers"/></h2>
        <c:choose>
            <c:when test="${empty actionBean.gatherers}">
                <p><f:message key="gatherer.list.empty"/></p>
            </c:when>
            <c:otherwise>
                <table class="basic">
                    <tr>
                        <th><f:message key="gatherer.username"/> </th>
                        <th><f:message key="gatherer.firstName"/></th> 
                        <th><f:message key="gatherer.lastName"/></th>
                        <th><f:message key="gatherer.info"/></th>
                            <shiro:hasRole name="ROLE_ADMIN">
                            <th></th>

                        </shiro:hasRole>
                    </tr>

                    <c:forEach items="${actionBean.gatherers}" var="gathererDto">

                        <tr>
                            <td><c:out value="${gathererDto.username}"/></td>
                            <td><c:out value="${gathererDto.firstName}"/></td>
                            <td><c:out value="${gathererDto.lastName}"/></td>
                            <td><c:out value="${gathererDto.info}"/></td>
                            <shiro:hasRole name="ROLE_ADMIN">
                                <td class="button"><s:link beanclass="cz.muni.fi.pa165.mushroom.website.web.GathererActionBean" event="delete">
                                        <s:param name="gathererDto.id" value="${gathererDto.id}"/>
                                        <f:message key="tab.delete"/>
                                    </s:link>
                                </td>

                            </shiro:hasRole>
                        </tr>

                    </c:forEach> 

                </table>
            </c:otherwise>
        </c:choose> 
    </s:layout-component>
</s:layout-render>
